//
//  ZYBannerView.swift
//  yychannelsubfeature
//
//  Created by wangzhipan on 2025/5/27.
//

import Foundation

public protocol IZYBannerModel {
    static var reuseId: String { get }
}

public protocol ZYBannerViewDataSource: AnyObject {
    func numberOfBanners(_ bannerView: ZYBannerView) ->Int
    func modelForBanner(_ bannerView: ZYBannerView, index: Int) -> IZYBannerModel
}

public class ZYBannerView: UIView {
    private var collectionView: UICollectionView
    private var flowLayout: UICollectionViewFlowLayout
    private var pageControl: UIPageControl
    
    weak var dataSource: ZYBannerViewDataSource! {
        didSet {
            
        }
    }
    
    override init(frame:CGRect) {
        flowLayout = UICollectionViewFlowLayout()
        flowLayout.scrollDirection = .horizontal
        flowLayout.minimumLineSpacing = 0
        flowLayout.minimumInteritemSpacing = 0
        flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
        flowLayout.headerReferenceSize = CGSize(width: 0, height: 0)
        flowLayout.footerReferenceSize = CGSize(width: 0, height: 0)
        
        collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: frame.width, height: frame.height), collectionViewLayout: flowLayout)
        pageControl = UIPageControl()
        super.init(frame: frame)
    }
    
}
